package com.zhengsr.latte.ui.recycler.itemdecoration;

import com.choices.divider.Divider;
import com.choices.divider.DividerItemDecoration;

/**
 * Created by zhengshaorui on 2018/5/27.
 */

public class BaseItemDecoration extends DividerItemDecoration {
    private final int COLOR;
    private final int SIZE;

    private  BaseItemDecoration(int color, int size) {
        this.COLOR = color;
        this.SIZE = size;
        setDividerLookup(new ItemTypeSpansize());
    }

    public static BaseItemDecoration create(int color, int size){
        return new BaseItemDecoration(color,size);
    }

    class ItemTypeSpansize extends DividerItemDecoration.SimpleDividerLookup {
        public ItemTypeSpansize() {
            super();
        }

        @Override
        public Divider getVerticalDivider(int position) {
            return new Divider.Builder()
                    .color(COLOR)
                    .size(SIZE)
                    .build();
        }

        @Override
        public Divider getHorizontalDivider(int position) {
            return new Divider.Builder()
                    .color(COLOR)
                    .size(SIZE)
                    .build();
        }
    }
}
